package cn.flexui.flexuiserver.config;

import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SpringDocConfig {

    @Bean
    public GroupedOpenApi backendApi() {
        return GroupedOpenApi.builder()
                .group("后台管理")
                .pathsToMatch("/api/manager/**")
                .packagesToScan("cn.flexui.flexuiserver.controller.manager")
                .build();
    }

    @Bean
    public GroupedOpenApi frontendApi() {
        return GroupedOpenApi.builder()
                .group("前端接口")
                .pathsToMatch("/api/**")
                .pathsToExclude("/api/manager/**")
                .packagesToScan("cn.flexui.flexuiserver.controller.web")
                .build();
    }

    @Bean
    public GroupedOpenApi dictApi() {
        return GroupedOpenApi.builder()
                .group("字典")
                .pathsToMatch("/api/dict/**")
                .packagesToScan("com.warape.aimechanician.controller.web")
                .build();
    }
}
